<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
  Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">



	<p:fieldset legend="Reserva de horario">
		<p:schedule value="#{experimentMBean.eventModel}" locale="pt"
			slotMinutes="60" view="agendaWeek" widgetVar="myschedule"
			allDaySlot="false" minTime="8" maxTime="23" resizable="false"
			draggable="false" axisFormat="HH:mm" timeFormat="" showWeekends="false"
			rightHeaderTemplate="">

			<p:ajax event="dateSelect" listener="#{experimentMBean.onDateSelect}"
				update="eventDetails" oncomplete="eventDialog.show()" />
			<p:ajax event="eventSelect"
				listener="#{experimentMBean.onEventSelect}" update="eventDetails"
				oncomplete="eventDialog.show()" />

		</p:schedule>

		<p:dialog widgetVar="eventDialog"
			header="Excluir ou adicionar uma reserva para este horario?">
			<h:panelGrid id="eventDetails" columns="2" style="align:right">

				<p:commandButton id="deleteButton" value="Excluir"
					actionListener="#{experimentMBean.deleteEvent}"
					oncomplete="myschedule.update();eventDialog.hide();" />
				<p:commandButton id="addButton" value="Reservar"
					actionListener="#{experimentMBean.addEvent}"
					oncomplete="myschedule.update();eventDialog.hide();" />
			</h:panelGrid>
		</p:dialog>

	</p:fieldset>

<script type="text/javascript">
	PrimeFaces.locales['pt'] = {
		closeText : 'Fechar',
		prevText : 'Proximo',
		nextText : 'Anterior',
		currentText : 'Hoje',
		monthNames : [ 'Janeiro', 'Fevereiro', 'Marco', 'Abril', 'Maio', 'Junho',
				'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ],
		monthNamesShort : [ 'Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago',
				'Set', 'Out', 'Nov', 'Dez' ],
		dayNames : [ 'Domingo', 'Segunda', 'Terca', 'Quarta', 'Quinta', 'Sexta',
				'Sabado' ],
		dayNamesShort : [ 'Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab' ],
		dayNamesMin : [ 'Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab' ],
		weekHeader : 'Sem',
		firstDay : 0,
		isRTL : false,
		showMonthAfterYear : false,
		yearSuffix : '',
		month : 'Mes',
		week : 'Semana',
		day : 'Dia',
	};

</script>
</ui:composition>